<script lang="ts" setup>
// 导入reactive函数，用于处理响应式数据 类似@state
import { reactive } from 'vue'
const obj = reactive ({
  name: '宝宝',
  age: 18
})

const addAge = () => {
  obj.age++
  console.log(obj)
}
</script>

<template>
 <p>{{ obj }}</p>
 <button @click="addAge">增加年龄</button>
</template>

<style scoped>
.box{
  width: 200px;
  height: 200px;
  background-color: #f00;
}
</style>